﻿using System;
using Ue.Framework.Data;
using Ue.Infrastructure.EntityFactoryFramework;
using Ue.Qcdz.Domain.Collectors;
namespace Ue.Qcdz.Repositories.Collectors
{
    public class CollectorFactory : IEntityFactory<Collector>
    {
        internal class FieldNames : FieldNamesBase
        {
            public const string SiteName = "SiteName";
            public const string SiteUrl = "SiteUrl";
            public const string Outskirts = "Outskirts";
            public const string ALink = "ALink";
            public const string Title = "Title";
            public const string Editor = "Editor";
            public const string Reference = "Reference";
            public const string ImageUrl = "ImageUrl";
            public const string LastDate = "LastDate";
            public const string Content = "Content";
            public const string Remark = "Remark";
            public const string Status = "Status";
        }


        #region IEntityFactory<Collector> 成员

        public Collector BuildEntity(System.Data.IDataReader reader)
        {
            return new CollectorProxy(
                  reader.Get<Guid>(CollectorFactory.FieldNames.EntityKey),
                  reader.Get<string>(CollectorFactory.FieldNames.SiteName),
                  reader.Get<string>(CollectorFactory.FieldNames.SiteUrl),
                  reader.Get<string>(CollectorFactory.FieldNames.Outskirts),
                  reader.Get<string>(CollectorFactory.FieldNames.ALink),
                  reader.Get<string>(CollectorFactory.FieldNames.Title),
                  reader.Get<string>(CollectorFactory.FieldNames.Editor),
                   reader.Get<string>(CollectorFactory.FieldNames.Reference),
                  reader.Get<string>(CollectorFactory.FieldNames.ImageUrl),
                  reader.Get<string>(CollectorFactory.FieldNames.Content),
                  reader.Get<DateTime>(CollectorFactory.FieldNames.LastDate),
                  reader.Get<string>(CollectorFactory.FieldNames.Remark),
                  reader.Get<int>(CollectorFactory.FieldNames.Status),
                  reader.Get<DateTime>(CollectorFactory.FieldNames.CreateOn)
            );
        }

        #endregion
    }
}
